#include <QtCore>
#include <QCoreApplication>
#include <QDebug>


void decodeFormalLanguage(QString formalLanguage)
{
 QString VariableName  = "";
 QString VariableValue = "";

 QRegExp formalLanguageRegExp("^\\{([\\w]):([\\w])[,]+$");

 if(formalLanguage.contains(formalLanguageRegExp))
 {
  VariableName  = formalLanguageRegExp.cap(1);
  VariableValue = formalLanguageRegExp.cap(2);

  qDebug() << "azeaze";
 }
 else
 {
  QRegExp formalLanguageRegExpS("^\\{([\\w]*):(.*)\\}$");
  if(formalLanguage.contains(formalLanguageRegExpS))
  {
   VariableName  = formalLanguageRegExpS.cap(1);
   VariableValue = formalLanguageRegExpS.cap(2);
  }
 }
 qDebug() << VariableName;
 qDebug() << VariableValue;

// QStringList VariableValueList = VariableValue.split(",");
//
// for(int i=0; i< VariableValueList.size(); ++i)
//  qDebug() << VariableValueList.at(i);

 decodeFormalLanguage(VariableValue);
}


int main(int argc, char *argv[])
{
 QCoreApplication a(argc, argv);

 QString formalLanguage = "";
 formalLanguage = "{PokerGame:";
 formalLanguage+= "{State:4,";
 formalLanguage+= "BigBlind:1000,";
 formalLanguage+= "Player:{Strategy:static+";
 formalLanguage+= "Position:9+";
 formalLanguage+= "Fitness:30";
 formalLanguage+= "}";
 formalLanguage+= "}";
 formalLanguage+= "}";

 decodeFormalLanguage(formalLanguage);

 return a.exec();
}
